#include<iostream>
#include<vector>
#include<cassert>
#include<ctime>
using namespace std;

#include"AVLTree.h"


void test1()
{
	AVLTree<int, int> at;
	int a[] = {1,2,3,4,5,6,7};
	for (int e : a)
	{
		at.Insert(make_pair(e, e));
	}

}

void test2()
{
	AVLTree<int, int> at;
	srand((unsigned int)time(nullptr));
	const int N = 10000;
	vector<int> v(N);
	for (int i = 0; i < N; ++i)
	{
		v[i] = rand() + i;
	}
	for (int e : v)
	{
		at.Insert(make_pair(e, e));
		at.IsBalanced();
	}
	cout << at.Height() << endl;
}

void test3()
{
	AVLTree<int, int> at;
	//int a[] = { 10583 ,20165 ,17857 ,18370 ,30429 ,19566 ,23697 ,3433 ,23583 ,32129 };
	int a[] = { 1,5,2,3,9,4,7,0,6,10 };
	//           1      5       2      3      9      4      7      0     6      10
	for (int i = 0; i < 10; ++i)
	{
		int e = a[i];
		cout << "insert:" << e;
		if (i == 4)
		{
			int x = 0;
		}
		at.Insert(make_pair(e, e));
		cout << endl;
		at.IsBalanced();
	}
}


int main()
{
	test2();
	return 0;
}